<?php

class connectDB{
	protected $host = "localhost";
	//protected $DBuser = "root";
	protected $DBuser = "christiani_root";
	//protected $DBpasswd = "";
	protected $DBpasswd = "asachan";
	//protected $DBName = "poem";
	protected $DBName = "christiani_poem";
	protected $connect;

	//Constructor
	public function __construct() {
	  $this->connect = new mysqli($this->host, $this->DBuser, $this->DBpasswd,$this->DBName);
		$this->connect->query("SET NAMES 'UTF8'");
		$this->connect->query("SET CHARACTER SET UTF8");
		$this->connect->query("SET CHARACTER_SET_RESULTS=UTF8'");
		mysqli_set_charset($this->connect,'utf8');
	}

	//Prepared Statements
	public function buildPreparedStatments($sqlQuery)
	{
		$stmt = $this->connect->prepare($sqlQuery);
		if (!$stmt)
		{
			throw new ErrorException($this->connect->error, $this->connect->errorno);
		}
		return $stmt;
	}

	public function queryRecord($sqlQuery)
	{
		return mysqli_query($this->connect, $sqlQuery);
	}
}
?>